﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.Composition;
using ExtendPropertyLib.WPF;
using ExtendPropertyLib;
using ExORMDesginer.RadWindow.Helper;
namespace ExORMDesginer.UserControls
{
    public class FilterDbSchemaViewModel : ViewModelBase<FilterDbSchemaInfo>
    {
        public override void OnDoCreate(ExtendObject item, params object[] args)
        {
            base.OnDoCreate(item, args);
            Model.Condition = Models.FilterConditionEnum.StartWith;
        }

        
        public static ExtendProperty IsTableSelectorProperty = RegisterProperty<FilterDbSchemaViewModel>(v => v.IsTableSelector);
        /// <summary>
        /// Table页选择
        /// </summary>
        public bool IsTableSelector { set { SetValue(IsTableSelectorProperty, value); } get { return (bool)GetValue(IsTableSelectorProperty); } }



        public override string GetViewTitle()
        {
            return "同步选项";
        }

        #region Event Method

        /// <summary>
        /// 同步
        /// </summary>
        public void Sync()
        {

            this.TryOK();

        }


        /// <summary>
        /// 条件选择
        /// </summary>
        public void ConditionSelect()
        {

            Model.SetAllTabItemByConditionFor(true);

        }
        /// <summary>
        /// 条件取消
        /// </summary>
        public void ConditionUnSelect()
        {
            Model.SetAllTabItemByConditionFor(false);
        }
        /// <summary>
        /// 选择当前Tab的所有项
        /// </summary>
        public void SelectedActivePage()
        {
            Model.SetActiveTabItemsFor(true);
        }
        /// <summary>
        /// 选择所有Tab的所有项
        /// </summary>
        public void SelectedAllPage()
        {
            Model.SetAllTabItemsFor(true);
        }
        /// <summary>
        /// 取消当前Tab的所有项
        /// </summary>
        public void UnSelectedActivePage()
        {
            Model.SetActiveTabItemsFor(false);
        }
        /// <summary>
        /// 取消选择所有Tab的所有项
        /// </summary>
        public void UnSelectedAllPage()
        {
            Model.SetAllTabItemsFor(false);
        }
        /// <summary>
        /// 取消
        /// </summary>
        public void UnSelectedAll()
        {
            Model.SetActiveTabItemsFor(false);
        }
        /// <summary>
        /// 全选
        /// </summary>
        public void SelectedAll()
        {
            Model.SetActiveTabItemsFor(true);
        }
        #endregion
    }
}
